package mytest;

import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;

public class Sources implements Runnable{
    private OutputStream outputStream = null;
    private FileInputStream originalFile;

    public Sources(OutputStream stream)
    {
        outputStream = stream;
    }
 
    @Override
    public void run()
    {
    	File file = new File("dataInput.xml");
    	byte[] readData = new byte[1024];
        try
        {
        	originalFile = new FileInputStream(file); 
        	int i = originalFile.read(readData);
        	while (i != -1) {
        		outputStream.write(readData, 0, i);
                i = originalFile.read(readData);
              }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            try
            {	
            	originalFile.close();
                outputStream.flush();
                outputStream.close();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }
}
